import {CART} from "../actions/types";
import cart1 from '../../assets/cart1.jpg'

const initialState = {
    goods: [
        // {
        //     id: 1,
        //     imgUrl: cart1,
        //     goodsTitle: '陶瓷碗龙泉宝刀',
        //     colorTitle: '淡青色',
        //     price: 100.00,
        //     checked: true,
        //     num: 1
        // },
        // {
        //     id: 2,
        //     imgUrl: cart1,
        //     goodsTitle: '天下第一陶瓷碗',
        //     colorTitle: '淡青色',
        //     price: 50.00,
        //     checked: true,
        //     num: 10
        // }
    ],
    selectedItems: []
};

export default (state = initialState, action) => {

    switch (action.type) {
        case CART.allToggleCheck:
        case CART.toggleCheck:
            return {...state, selectedItems: action.payload};
        case CART.getList:
            console.log(action);
            return {...state, goods: action.payload.dataList};
        default:
            return state
    }
}
